package com.java.code.utils;

import com.carrotsearch.sizeof.RamUsageEstimator;

/**
 * @author weichuanyuan
 * @e-mail wei.cy@bsoft.com.cn
 * @date 2021/10/18 20:36
 * @package com.java.code.utils
 * @description
 */
public class ObjectUtils {
    /**
     * 不为空
     *
     * @param source
     * @return
     */
    public static boolean isNotNull(Object source) {
        return source != null;
    }

    /**
     * 空
     *
     * @param source
     * @return
     */
    public static boolean isNull(Object source) {
        return source == null;
    }

    /**
     * 打印对象的大小
     * 字节B KB MB GB
     * @param source
     */
    public static long memorySize(Object source)
    {
        return RamUsageEstimator.sizeOf(source);
    }
}
